package com.swz.dcrm.api;

import androidx.appcompat.widget.DialogTitle;

import com.swz.dcrm.model.Announcement;
import com.swz.dcrm.model.Approval;
import com.swz.dcrm.model.BaseResponse;
import com.swz.dcrm.model.Boutique;
import com.swz.dcrm.model.BoutiqueGroup;
import com.swz.dcrm.model.BuildAndDefeatedCount;
import com.swz.dcrm.model.Car;
import com.swz.dcrm.model.CarBrand;
import com.swz.dcrm.model.CarCompare;
import com.swz.dcrm.model.CarDetail;
import com.swz.dcrm.model.CarModel;
import com.swz.dcrm.model.CarModelRelativeMerits;
import com.swz.dcrm.model.CarModelTag;
import com.swz.dcrm.model.CarOrder;
import com.swz.dcrm.model.CarSeries;
import com.swz.dcrm.model.CustomerDefeated;
import com.swz.dcrm.model.DailyComeShop;
import com.swz.dcrm.model.DailyCustomer;
import com.swz.dcrm.model.DailyTarget;
import com.swz.dcrm.model.DailyTask;
import com.swz.dcrm.model.DeliveryAndCancleOrderCount;
import com.swz.dcrm.model.DeliveryCar;
import com.swz.dcrm.model.HardWork;
import com.swz.dcrm.model.MonthSummary;
import com.swz.dcrm.model.MonthlyGoal;
import com.swz.dcrm.model.MonthlyGraph;
import com.swz.dcrm.model.MonthlyStructure;
import com.swz.dcrm.model.MonthlyTarget;
import com.swz.dcrm.model.Order;
import com.swz.dcrm.model.RankingList;
import com.swz.dcrm.model.RankingListModel;
import com.swz.dcrm.model.StatisticsOrder;
import com.swz.dcrm.model.SuggestLevel;
import com.swz.dcrm.model.Tab;
import com.swz.dcrm.model.Clue;
import com.swz.dcrm.model.ClueDetail;
import com.swz.dcrm.model.ClueRecord;
import com.swz.dcrm.model.Dictionary;
import com.swz.dcrm.model.Group;
import com.swz.dcrm.model.GroupGoal;
import com.swz.dcrm.model.Insurance;
import com.swz.dcrm.model.Page;
import com.swz.dcrm.model.PageResponse;
import com.swz.dcrm.model.PersonalInfo;
import com.swz.dcrm.model.PersonalInfoUpdateVo;
import com.swz.dcrm.model.Quotation;
import com.swz.dcrm.model.Role;
import com.swz.dcrm.model.Schedule;
import com.swz.dcrm.model.TodayCount;
import com.swz.dcrm.model.Token;
import com.swz.dcrm.model.VisitRecord;
import com.swz.dcrm.model.VisitRecordAndSchedule;
import com.swz.dcrm.model.Work;
import com.swz.dcrm.model.WorkRemind;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.Url;

public interface DcrmApi {

    @POST("api/user/login")
    @FormUrlEncoded
    Call<BaseResponse<Token>> login(@Field("account") String account, @Field("password") String pwd);

    @GET
    Call<BaseResponse<Page<ClueRecord>>> findTodayContact(@Url String url, @Query("status") int status, @Query("page") int page, @Query("size") int size);

    @GET
    Call<BaseResponse<TodayCount>> findTodayCount(@Url String url);

    @GET("api/bs/clue/detailVO")
    Call<BaseResponse<ClueDetail>> findClueDetailByClueId(@Query("id") long clueId);

    @POST("api/sys/dictionary/listByTypeCode")//查字典
    @FormUrlEncoded
    Call<BaseResponse<List<Dictionary>>> findDictionaryByTypeCode(@Field("typeCode") String code);

    @GET("api/bs/clue/record/sendCarCount")
    Call<BaseResponse<List<String>>> findNearlyDeliveryCount();

    @GET("api/bs/clue/record/sendCar")
    Call<BaseResponse<Page<DeliveryCar>>> findNearlyDelivery(@Query("day") int day, @Query("page") int page,
                                                             @Query("size") int size);

    @GET("api/bs/clue/record/potentialClueList")
    Call<BaseResponse<Page<ClueRecord>>> potentialClueList(@Query("comeShopType") Integer comeShopType,
                                                           @Query("sortType") int sortType,
                                                           @Query("page") Integer page, @Query("size") int size);

    @GET("api/bs/clue/record/orderClueList")
    Call<BaseResponse<Page<ClueRecord>>> orderClueList(@Query("orderTime") String orderTime,
                                                       @Query("deliveryCarTime") String deliveryCarTime,
                                                       @Query("page") int page, @Query("size") int size);

    @GET("api/bs/clue/record/defeatedClueList")
    Call<BaseResponse<Page<ClueRecord>>> defeatedClueList(@Query("comeShopType") Integer comeShopType,
                                                          @Query("defeatedHasBuyCar") boolean defeatedHasBuyCar,
                                                          @Query("page") int page, @Query("size") int size);

    @GET("api/bs/clue/record/authorizedClueList")
    Call<BaseResponse<List<ClueRecord>>>getAuthorizedClueList();
    @POST("api/bs/clue/record/addRecordAndSchedule")
    Call<BaseResponse<VisitRecord>> addRecordAndSchedule(@Body VisitRecordAndSchedule visitRecordAndSchedule);

    @POST("api/day/schedule/searchAdvanceApp")
    @FormUrlEncoded
    Call<BaseResponse<Page<Schedule>>> getSchedule(@Field("GTE_startTime") String startTime, @Field("LT_startTime") String endTime);

    @POST("api/day/schedule/add")
    @FormUrlEncoded
    Call<BaseResponse<Schedule>> addSchedule(@FieldMap HashMap<String, String> map);

    @POST("api/day/schedule/delete")
    @FormUrlEncoded
    Call<BaseResponse<Object>> delSchedule(@Field("id") long id);


    @POST("api/notice/searchAdvanceApp")
    @FormUrlEncoded
    Call<BaseResponse<Page<Announcement>>> findAnnouncement(@Field("page") Integer page, @Field("size") int size, @Field("sort") String sort);

    @POST("api/notice/add")
    @FormUrlEncoded
    Call<BaseResponse<Announcement>> addAnnouncement(@Field("content") String content, @Field("startTime") String startTime,
                                                     @Field("endTime") String endTime);

    @POST("api/notice/delete")
    @FormUrlEncoded
    Call<BaseResponse<Announcement>> delAnnouncement(@Field("id") long id);

    @POST("api/bs/clue/addApp")
    Call<BaseResponse<Clue>> addClue(@Body Clue clue);

    @POST("api/bs/clue/update")
    Call<BaseResponse<Clue>> updateClue(@Body Clue clue);


    @GET("api/user/getPersonInfo")
    Call<BaseResponse<PersonalInfo>> getPersonalInfo();

    @GET("api/user/searchUserInShop")
    Call<PageResponse<PersonalInfo>> getAddressBook(@Query("page") int page, @Query("size") int size);

    @GET("api/user/searchEmployeeList")
    Call<PageResponse<PersonalInfo>> getStaff(@Query("page") int page, @Query("size") int size);

    @GET("api/user/findbyid")
    Call<BaseResponse<PersonalInfo>> getStaffById(@Query("userId") long userId);

    @POST("api/user/updatePersonnalDetails")
    @FormUrlEncoded
    Call<BaseResponse<PersonalInfo>> updatePersonalInfo(@FieldMap Map<String,String> map);

    @POST("api/memeber/goal/searchMemberGoal")
    @FormUrlEncoded
    Call<BaseResponse<List<GroupGoal>>> getStaffGoal(@Field("year") int year, @Field("month") int month);

    @POST("api/memeber/goal/batchUpdateMemberGoal")
    Call<BaseResponse<GroupGoal>> updateGroupStaffGoal(@Body GroupGoal group);

    @POST("api/group/searchAdvanceApp")
    @FormUrlEncoded
    Call<BaseResponse<Page<Group>>> getGroups(@Field("page") int page, @Query("size") int size);

    @POST("api/group/update")
    @FormUrlEncoded
    Call<BaseResponse<Group>> updateGroup(@Field("id") long id, @Field("name") String name);

    @POST("api/group/add")
    @FormUrlEncoded
    Call<BaseResponse<Group>> addGroup(@Field("name") String name);

    @POST("api/group/delete")
    @FormUrlEncoded
    Call<BaseResponse<Group>> delGroup(@Field("id") long id);

    @GET("api/role/getCanSelectRole")
    Call<BaseResponse<List<Role>>> getRole();

    @GET("api/config/brand/en/getShopCarBrandList")//api/bs/car/brand/getShopCarBrandList
    Call<BaseResponse<List<CarBrand>>> getCarBrand();

    @GET("api/config/series/en/getShopCarSeriesList")
    Call<BaseResponse<List<CarSeries>>> getCarSeries( @Query("pinpaiId") long brandId);

    @POST("api/bs/config/shop/car/en/searchApp")//查店铺车型
    @FormUrlEncoded
    Call<PageResponse<CarModel>> getCarModel(@Field("page") int page, @Field("size") int size, @Field("pChexiId") long seriesId);

    @POST("api/bs/shop/car/model/findBsShopCarModelVO")
    @FormUrlEncoded
    Call<PageResponse<CarModel>> getCarModel(@Field("page") int page, @Field("size") int size, @Field("carModelName") String carModelName);


    @POST("api/bs/shop/car/model/findMyCollectedCarModelVO")
    @FormUrlEncoded
    Call<PageResponse<CarModel>> getCollectedCarModel(@Field("page") int page, @Field("size") int size, @Field("carModelName") String carModelName);

    @POST("api/user/bs/shop/car/model/add")
    @FormUrlEncoded
    Call<BaseResponse<CarModel>> collectCarModel(@Field("shopCarModelId") long shopCarModelId);

    @POST("api/user/bs/shop/car/model/batchDeleteCollectCar")
    @FormUrlEncoded
    Call<BaseResponse<Object>> batchDelCollected(@Field("carModelIds") List<Long> list);

   @POST("api/bs/clue/record/update")
    Call<BaseResponse<VisitRecord>> updateVisitRecord(@Body VisitRecord visitRecord);
   @POST("api/user/createEmployee")
    Call<BaseResponse<PersonalInfo>>addStaff(@Body PersonalInfoUpdateVo personalInfo);

   @POST("api/bs/boutique/group/searchAdvanceApp")
   @FormUrlEncoded
    Call<PageResponse<BoutiqueGroup>> getBoutiqueGroup(@Field("size") int size);

   @POST("api/bs/boutique/config/searchAdvanceApp")
   @FormUrlEncoded
   Call<PageResponse<Boutique>>getBoutiques(@Field("IN_id") String id,@Field("LIKE_boutiqueName") String boutiqueName);

   @Multipart
   @POST("api/file/uploadOssFile")
    Call<BaseResponse<String>>uploadOssFile(@Part("ext")String ext, @Part MultipartBody.Part part);

   @GET("api/bs/config/shop/car/en/detailVO")
   Call<BaseResponse<CarDetail>>getCarDetail(@Query("id") long id);
    @GET("api/bs/config/shop/car/en/detail")
    Call<BaseResponse<CarDetail>>getCarDetailParam(@Query("id") long id);
    @GET("api/bs/shop/car/model/detail")
    Call<BaseResponse<CarModel>> getCarModelDetail(@Query("id")long id);
    @POST("api/bs/quotation/add")
    Call<BaseResponse<Quotation>>addQuotation(@Body Quotation quotation);
    @GET("api/bs/quotation/detail")
    Call<BaseResponse<Quotation>>getQuotationById(@Query("id")long id);
    @POST("api/bs/insurance/config/searchApp")
    @FormUrlEncoded
    Call<BaseResponse<List<Insurance>>> getInsurance(@Field("size")int size);
    @POST("api/bs/quotation/applyApproval")
    @FormUrlEncoded
    Call<BaseResponse<String>>applyApproval(@Field("id")long id,@Field("clueId")long clueId);

    @POST("api/bs/apply/applyCancelOrder")
    @FormUrlEncoded
    Call<BaseResponse<String>>applyCancelOrder(@Field("orderId")long orderId,@Field("reason")String reason);
    @POST("api/warehouse/car/statisticsEachStatusCount")
    Call<BaseResponse<List<Tab>>>getCarTabList();
    @POST("api/warehouse/car/searchWarehouseCarVO")
    @FormUrlEncoded
    Call<PageResponse<Car>> getCarList(@Field("status")int status,@Field("carModelName")String carModelName,@Field("page") int page, @Field("size") int size);

    @POST("api/bs/apply/statisticsEachTypeCount")
    @FormUrlEncoded
    Call<BaseResponse<List<Tab>>>getApprovalTabList(@Field("isHandled")boolean isHandled);

    @POST("api/bs/apply/searchAdvanceApp")
    @FormUrlEncoded
    Call<PageResponse<Approval>> getApprovalList(@Field("page") int page, @Field("size") int size,@Field("EQ_applyType")Integer applyType,
                                                 @Field("NULL_handleResult")Boolean NULL_handleResult,  @Field("INN_handleResult")Boolean INN_handleResult);
    @POST("api/bs/car/order/add")
    Call<BaseResponse<CarOrder>> addCarOrder(@Body CarOrder carOrder);

    @POST("api/bs/apply/batchUpdateHandleResult")
    @FormUrlEncoded
    Call<BaseResponse<String>> confirmApprovalOpinion(@Field("applyIds")List<Long>ids,@Field("handleResult")int handleResult,
                                                      @Field("handleComment")String handleComment);

    @POST("api/warehouse/car/judgeStockByColorAndCarModel")
    @FormUrlEncoded
    Call<BaseResponse<Car>>getCarInWareHouse(@Field("color")String color,@Field("carModelId")long carModelId);

    @POST("api/bs/car/order/statisticsDeliveryCarAndCancelOrder")
    @FormUrlEncoded
    Call<BaseResponse<List<DeliveryAndCancleOrderCount>>>getDeliveryAndCancleOrderAnalyze(@Field("startTime")String startTime, @Field("endTime")String  endTime);
    @POST("api/bs/clue/statisticsBuildAndDefeated")
    @FormUrlEncoded
    Call<BaseResponse<List<BuildAndDefeatedCount>>>getBuildAndDefeatedAnalyze(@Field("startTime")String startTime, @Field("endTime")String  endTime);
    @GET("api/bs/clue/record/appIndexCount")
    Call<BaseResponse<Work>> getWorkCount();
    @POST("api/bs/shop/car/model/searchAdvanceApp")
    @FormUrlEncoded
    Call<BaseResponse<List<CarModel>>> getCompareCar(@Field("EQ_competingCarModel")boolean competingCarModel);
    @POST("api/car/model/tag/getCarModelAndTagDetail")
    @FormUrlEncoded
    Call<BaseResponse<CarModelRelativeMerits>>getCarModelRelativeMerits(@Field("carModelId")long carModelId);
    @POST("api/car/model/tag/delete")
    @FormUrlEncoded
    Call<BaseResponse<String>>delCarModelRelativeMerits(@Field("id")long id);
    @POST("api/car/model/tag/add")
    @FormUrlEncoded
    Call<BaseResponse<CarModelTag>>addCarModelRelativeMerits(@Field("carModelId")long id, @Field("tagType") int tagType, @Field("tagContext")String tagContext);
    @POST("api/bs/apply/applyDefeatedClue")
    @FormUrlEncoded
    Call<BaseResponse<String>> applyDefeatedClue(@Field("clueId")long clueId,@Field("defeatedHasBuyCar")boolean defeatedHasBuyCar,
                                                 @Field("reason")String reason);
    @POST("api/bs/apply/applyHandUpClue")
    @FormUrlEncoded
    Call<BaseResponse<String>> applyHandUpClue(@Field("clueId")long clueId,
                                                 @Field("reason")String reason);
    @POST("api/car/model/competing/getCarModelCompetingList")
    @FormUrlEncoded
    Call<BaseResponse<CarCompare>> getCarCompareConfig(@Field("carModelId")long carModelId);
    @POST("api/bs/car/order/deliveryCar")
    @FormUrlEncoded
    Call<BaseResponse<String>> deliveryCar(@Field("id")long id);
    @POST("api/bs/car/order/search")
    @FormUrlEncoded
    Call<PageResponse<Order>> getCarOrder(@Field("clueId")long clueId,@Field("page") int page, @Field("size") int size);

    @POST("api/bs/car/order/getRankingList")
    @FormUrlEncoded
    Call<BaseResponse<RankingListModel>>getSaleRankingList(@Field("startTime")String startTime,@Field("endTime")String endTime,
                                                           @Field("statisticsType") int statisticsType);
    @POST("api/bs/clue/statisticsHardWorkingList")
    @FormUrlEncoded
    Call<BaseResponse<List<HardWork>>>getHardWorkingRankingList(@Field("startTime")String startTime, @Field("endTime")String endTime);
    @POST("api/bs/car/order/statisticsCancelOrder")
    @FormUrlEncoded
    Call<BaseResponse<List<RankingList>>>getCancelOrder(@Field("startTime")String startTime, @Field("endTime")String endTime);

    @POST("api/bs/clue/statisticsIntentCustomerDefeated")
    @FormUrlEncoded
    Call<BaseResponse<List<CustomerDefeated>>>getCustomerDefeated(@Field("startTime")String startTime,
                                                                  @Field("endTime")String endTime,@Field("carModelId")long carModelId);
    @POST("api/bs/car/order/statisticsDeliveryCarAndOrder")
    Call<BaseResponse<List<StatisticsOrder>>>getStatisticsOrder();
    @GET("api/bs/clue/record/getSuggestLevel")
    Call<BaseResponse<SuggestLevel>>getSuggestLevel(@Query("clueId")long clueId,@Query("phoneResult")int phoneResult,@Query("contactResult") int contactResult);
    @GET("api/bs/car/order/detail")
    Call<BaseResponse<CarOrder>>getOrderDetail(@Query("id")long orderId);
    @POST("api/bs/clue/currentMonthSummary")
    Call<BaseResponse<MonthSummary>>getMonthSummary();
    @POST("api/bs/summary/dailyTargetCount")
    Call<BaseResponse<DailyTarget>>getDailyTarget();
    @POST("api/bs/summary/dailyComeShopCount")
    Call<BaseResponse<DailyComeShop>>getDailyComeShop();
    @POST("api/bs/summary/dailyFocusCustomerCount")
    Call<BaseResponse<DailyCustomer>>getDailyCustomer();
    @POST("api/bs/summary/dailyTaskCount")
    Call<BaseResponse<DailyTask>>getDailyTask();
    @POST("api/bs/summary/monthlyGoalCount")
    Call<BaseResponse<MonthlyGoal>>getMonthlyGoal();
    @POST("api/bs/summary/monthlyTargetCount")
    Call<BaseResponse<MonthlyTarget>>getMonthlyTarget();
    @POST("api/bs/summary/monthlyStructureCount")
    Call<BaseResponse<MonthlyStructure>>getMonthlyStructure();
    @POST("api/bs/summary/monthlyGraphCount")
    Call<BaseResponse<MonthlyGraph>>getMonthlyGraph();
    @GET("api/bs/clue/record/workRemind")
    Call<BaseResponse<List<WorkRemind>>>getWorkRemind();
    @GET("api/bs/clue/searchCurUserClue")
    Call<BaseResponse<Page<Clue>>> getUsableClue(@Query("page")int page ,@Query("size")int size);
    @GET("api/user/searchConsultantUsers")
    Call<PageResponse<PersonalInfo>>getSaleMan(@Query("page") int page,@Query("size") int size);
    @POST("api/bs/clue/authorized")
    @FormUrlEncoded
    Call<BaseResponse<String>>authorized(@Field("id")long clueId,@Field("authorizedUserId") long authorizedUserId);
}
